#include "blisp.h"

Type Function_t;

Object *Function_new(void){return ONIL;}

/* Eval - TODO */
Object *Function_eval(Object *o){return ONIL;}

/*
 * C string representation of function
 * For now, just a pointer address
 * "#<function:{ptr addr}>#"
 *   --> len: 14 (incl. NUL)
 *   I.e., length of string w/o ptr addr
 */
const char *Function_to_cstr(Object *o)
{
	char *buffer = GC_MALLOC_ATOMIC(14 + (2 * sizeof(ptrdiff_t)));
	sprintf(buffer, "#<function:%x>", (unsigned int) getfunction(o));
	return (const char *) buffer;
}

/* FIXME: just a ptr cmp stub */
int function_equal(Object *o1, Object *o2)
{
	return eq_p(o1, o2);
}

/* FIXME: just a ptr cmp stub */
Object *Function_equal(Object *o1, Object *o2)
{
	return Eq_p(o1, o2);
}
